from django.db import models
from apps.common.base.models import BaseModel

class Router(BaseModel):
    '''路由模型'''

    title=models.CharField("标题", max_length=200, blank=True, null=True)
    icon=models.CharField("图标", max_length=200, blank=True, null=True, default='')
    name=models.CharField("名称", max_length=100, blank=True, null=True)
    path=models.CharField("路径", max_length=200, blank=True, null=True)
    component=models.CharField("目录", max_length=200, blank=True, null=True, default='') #Layout
    redirect=models.CharField("重指向", max_length=200, blank=True, null=True)
    hidden = models.IntegerField("是否显示", default=0)

    parent = models.ForeignKey('self', related_name='children', verbose_name='上级分类', on_delete=models.SET_NULL, null=True, blank=True,  db_constraint=False)
    is_root = models.BooleanField(default=False, verbose_name='是否是一级分类')

    class Meta:
        verbose_name = 'Router'
        verbose_name_plural = verbose_name